package com.design.迭代器模式;

import java.util.ArrayList;
import java.util.List;

public abstract class AbstractObjectList {

	//创建一个object的list集合
	protected List<Object> objectList = new ArrayList<Object>();;
	
	/*
	 * 构造函数
	 */
	public AbstractObjectList(List<Object> list) {
		this.objectList = list;
	}
	
	
	public void add(Object o) {
		this.objectList.add(o);
	}
	
	public void remove(Object o) {
		if(!this.objectList.isEmpty()) {
			this.objectList.remove(o);
		}
	}
	
	public List<Object> getList() {
		return this.objectList;
	}
	
	/**
	 * 由子类去实现
	 * @return
	 */
	public abstract AbstractIterator createIterator();
	
	
}
